home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / lib / rcscripts / net.modules.d / helpers.d / dhclient-udhcpc-wrapper < prev    next >
Text File  |  2006-04-25  |  1KB  |  54 lines

  1. #!/bin/sh
  2. # Copyright (c) 2004-2005 Gentoo Foundation
  3. # Distributed under the terms of the GNU General Public License v2
  4. # $Header$
  5.  
  6. # Contributed by Roy Marples (uberlord@gentoo.org)
  7.  
  8. # Instead of writing new functions for dhclient, we simply map their variables
  9. # over to udhcpc style ones and call those scripts!
  10.  
  11. iface_type=${1}
  12.  
  13. echo ${reason}
  14. case "${reason}" in
  15.     BOUND|REBOOT|REBIND) action=bound ;;
  16.     RENEW) action=renew ;;
  17.     RELEASE|PREINIT|FAIL|EXPIRE|TIMEOUT) action=deconfig ;;
  18.     MEDIUM) exit 0 ;;
  19. esac
  20.  
  21. if [[ -z ${action} ]]; then
  22.     echo "dhclient sent an unknown action ${reason}!" >&2
  23.     exit 1
  24. fi
  25.  
  26. export ip=${new_ip_address}
  27. export subnet=${new_subnet_mask} 
  28. export broadcast=${new_broadcast_address}
  29. routers=( ${new_routers} )
  30. export router=${routers[0]}
  31. export new_routers=${router}
  32.  
  33. export hostname=${new_hostname}
  34.  
  35. export domain=${new_domain_name}
  36. export dns=${new_domain_name_servers}
  37. export new_domain_name=${domain}
  38.  
  39. export ntpsrv=${new_domain_name_servers}
  40.  
  41. export nisdomain=${new_nis_domain}
  42. export nissrv=${new_nis_servers}
  43.  
  44. export module=dhclient
  45.  
  46. # Execute the dhclient script and exit with it's code
  47. /lib/rcscripts/net.modules.d/helpers.d/udhcpc-${iface_type} ${action}
  48. result="$?"
  49.  
  50. [[ -e /etc/dhcp/dhclient-exit-hooks ]] \
  51.     && ( . /etc/dhcp/dhclient-exit-hooks )
  52.  
  53. exit "${result}"
  54.